import Vue from 'vue';
import Router from 'vue-router';
import index from '../page/index';                             //首页
import bookMall from '../page/bookMall';                       //书城
import bookShelf from '../page/bookShelf';                     //我的书架
import userCenter from '../page/userCenter';                   //个人中心
import buy from '../page/buy';                                 //立即购买
import orderDetail from '../page/orderDetail';                 //订单详情
import ebookDetail from '../page/ebookDetail';                 //电子书内页详情
import pageContent from '../page/pageContent';                         //电子书内容
import balance from '../page/balance';                         //余额
import putForward from '../page/putForward';                   //佣金提现
import Recharge from '../page/Recharge';                       //书币充值
import chargeLog from '../page/chargeLog';                     //充值记录
import bookOrder from '../page/bookOrder';                     //订单
import recommend from '../page/recommend';                     //我的推荐
import invitingFriends from '../page/invitingFriends';         //邀请好友
import serviceCenter from '../page/serviceCenter';             //客服中心




Vue.use(Router);


export default new Router({
	mode: 'history',
	base: '/',
	routes: [
		{
			path: '/',
			component: index,
			name: 'index'
		},{
			path: '/index',
			component: index,
			name: 'index'
		},{
			path: '/bookMall',
			component: bookMall,
			name: 'bookMall'
		},{
			path: '/bookShelf',
			component: bookShelf,
			name: 'bookShelf'
		},{
			path: '/userCenter',
			component: userCenter,
			name: 'userCenter'
		},{
			path: '/buy',
			component: buy,
			name: 'buy'
		},{
			path: '/orderDetail',
			component: orderDetail,
			name: 'orderDetail'
		},{
			path: '/ebookDetail',
			component: ebookDetail,
			name: 'ebookDetail'
		},{
			path: '/pageContent',
			component: pageContent,
			name: 'pageContent'
		},{
			path: '/balance',
			component: balance,
			name: 'balance'
		},{
			path: '/putForward',
			component: putForward,
			name: 'putForward'
		},{
			path: '/Recharge',
			component: Recharge,
			name: 'Recharge'
		},{
			path: '/chargeLog',
			component: chargeLog,
			name: 'chargeLog'
		},{
			path: '/bookOrder',
			component: bookOrder,
			name: 'bookOrder'
		},{
			path: '/recommend',
			component: recommend,
			name: 'recommend'
		},{
			path: '/invitingFriends',
			component: invitingFriends,
			name: 'invitingFriends'
		},{
			path: '/serviceCenter',
			component: serviceCenter,
			name: 'serviceCenter'
		},
	],
	scrollBehavior(to, from, savedPosition) {
		if (savedPosition) {
			return savedPosition;
		} else {
			document.scrollingElement.scrollTop = 0;
		}
	}
});